const a = [{
    punish_state: 1
}, {
    punish_state: 0
}, {
    punish_state: 2
}]
const b = a.sort((a, b) => a.punish_state - b.punish_state);
console.log(b)

const c = [1, 2, 3, 3, 4, 4, 4, 55, 5, 5, 6, 6];
const d = [1, 2, 3, 3, 4, 4, 4, 55, 5, 5, 6, 6];
console.time('a')


var f = unique(d);
console.log(f)
console.timeEnd('a')

console.time('b')
console.log(Array.from(new Set(c)))
console.timeEnd('b')
console.time('c')
console.log([...new Set(c)])
console.timeEnd('c')

function unique(arr) {
    var res = [];
    var obj = {};
    for (var i = 0; i < arr.length; i++) {
        if (!obj[arr[i]]) {
            obj[arr[i]] = 1;
            res.push(arr[i]);
        }
    }
    return res;
}

const obj = [{
    name: 'aa'
}, {
    name: 'aa'
}, {
    name: 'bb'
}]


console.log(uniqueArray(obj))